package com.dt.platform.generator.module.hr;


import com.dt.platform.constants.db.HrTables;
import com.dt.platform.constants.enums.hr.PaperQuestionAnswerEnum;
import com.dt.platform.constants.enums.hr.PaperQuestionTypeEnum;
import com.dt.platform.domain.hr.PaperQuestionItem;
import com.dt.platform.generator.config.Config;
import com.dt.platform.hr.page.PaperQuestionItemPageController;
import com.dt.platform.proxy.hr.PaperQuestionItemServiceProxy;
import com.github.foxnic.generator.config.WriteMode;


public class APaperQuestionItemGtr extends BaseCodeGenerator {
    public APaperQuestionItemGtr() {
        super(HrTables.HR_PAPER_QUESTION_ITEM.$TABLE,"811268060357853184");
    }

    public void generateCode() throws Exception {
        System.out.println(this.getClass().getName());

        cfg.view().field(HrTables.HR_PAPER_QUESTION_ITEM.ID).basic().hidden(true);


        cfg.getPoClassFile().addSimpleProperty(String.class,"selectedCode","selectedCode","selectedCode");


        cfg.view().list().disableBatchDelete();
        cfg.view().field(HrTables.HR_PAPER_QUESTION_ITEM.UPDATE_BY).form().table().disable(true);
        cfg.view().field(HrTables.HR_PAPER_QUESTION_ITEM.UPDATE_BY).form().table().disable(true);
        cfg.view().field(HrTables.HR_PAPER_QUESTION_ITEM.UPDATE_TIME).form().table().disable(true);
        cfg.view().field(HrTables.HR_PAPER_QUESTION_ITEM.CREATE_BY).form().table().disable(true);
        cfg.view().field(HrTables.HR_PAPER_QUESTION_ITEM.SELECTED).form().table().disable(true);
        cfg.view().field(HrTables.HR_PAPER_QUESTION_ITEM.SORT).form().table().disable(true);
        cfg.view().field(HrTables.HR_PAPER_QUESTION_ITEM.IMAGE_ID).form().table().disable(true);

        cfg.view().field(HrTables.HR_PAPER_QUESTION_ITEM.CREATE_TIME).form().table().disable(true);
        cfg.view().field(HrTables.HR_PAPER_QUESTION_ITEM.QUESTION_ID).form().table().disable(true);
        //cfg.view().field(HrTables.HR_PAPER_QUESTION_ITEM.CODE).form().table().disable(true);



        cfg.view().search().labelWidth(1,Config.searchLabelWidth);
        cfg.view().search().labelWidth(2,Config.searchLabelWidth);
        cfg.view().search().labelWidth(3,Config.searchLabelWidth);
        cfg.view().search().labelWidth(4,Config.searchLabelWidth);
        cfg.view().search().inputWidth(Config.searchInputWidth);


        cfg.view().field(HrTables.HR_PAPER_QUESTION_ITEM.SELECTED).form().validate().required().form()
                .radioBox().enumType(PaperQuestionAnswerEnum.class).defaultIndex(0);

        cfg.view().search().rowsDisplay(1);
        cfg.view().formWindow().width("80%");;
        cfg.view().formWindow().bottomSpace(150);

        cfg.view().field(HrTables.HR_PAPER_QUESTION_ITEM.CONTENT).search().fuzzySearch();

        cfg.view().search().inputLayout(
                new Object[]{
                        HrTables.HR_PAPER_QUESTION_ITEM.CONTENT,

                }
        );

        cfg.view().field(HrTables.HR_PAPER_QUESTION_ITEM.CONTENT).form().textArea().height(80);
        cfg.view().field(HrTables.HR_PAPER_QUESTION_ITEM.IMAGE_ID).form().upload().buttonLabel("上传图片").maxFileCount(1).acceptSingleImage();



        cfg.view().list().addJsVariable("PAGE_TYPE","[[${pageType}]]","pageType");
        cfg.view().list().addJsVariable("QUESTION_ID","[[${questionId}]]","questionId");

        cfg.view().list().addJsVariable("SELECTED_CODE","[[${selectedCode}]]","selectedCode");


        cfg.view().form().addJsVariable("QUESTION_ID","[[${questionId}]]","questionId");
        cfg.view().form().addJsVariable("SELECTED_CODE","[[${selectedCode}]]","selectedCode");

        cfg.view().form().addGroup(null,
                new Object[] {
                        HrTables.HR_PAPER_QUESTION_ITEM.SELECTED,
                        HrTables.HR_PAPER_QUESTION_ITEM.CONTENT,


                }
        );
        //文件生成覆盖模式
        cfg.overrides()
                .setServiceIntfAnfImpl(WriteMode.IGNORE) //服务与接口
                .setControllerAndAgent(WriteMode.IGNORE) //Rest
                .setPageController(WriteMode.IGNORE) //页面控制器
                .setBpmEventAdaptor(WriteMode.COVER_EXISTS_FILE)
                .setFormPage(WriteMode.COVER_EXISTS_FILE) //表单HTML页
                .setListPage(WriteMode.COVER_EXISTS_FILE) //列表HTML页
                .setExtendJsFile(WriteMode.IGNORE);
        //生成代码
        cfg.buildAll();
    }

    public static void main(String[] args) throws Exception {
        APaperQuestionItemGtr g=new APaperQuestionItemGtr();
        //生成代码
        g.generateCode();

        //移除之前生成的菜单，视情况执行
       // System.out.println("############"+g.getTablePrefix());
       // g.removeByBatchId("801716675761143808");
      //  //生成菜单
      // g.generateMenu(PaperQuestionItemServiceProxy.class, PaperQuestionItemPageController.class);
    }
}
